/*
 * Prismatic.h
 *
 *  Created on: Jan 2, 2009
 *      Author: Michael
 */

#ifndef PRISMATIC_H_
#define PRISMATIC_H_

#include "d3dApp.h"
#include <tchar.h>
//#include <crtdbg.h>
#include "GfxStats.h"
#include "DInput.h"
#include <time.h>
#include "DirectSound.h"
#include "GameState.h"
#include "dsound.h"
#include "Defines.h"
#include <vector>

class GameState;

class Prismatic:public D3DApp
{

private:
	GfxStats* mGfxStats;
	ID3DXFont* mFont;


	// adds in the sound class
	CDirectSound sound;

	//camera stuffs and others
	float mCameraRotationY;
	float mCameraRadius;
	float mCameraHeight;

	D3DXMATRIX mView;
	D3DXMATRIX mProj;

	//effects object and buffer object for effect
	ID3DXEffect* mFX;

	//handles for technique and world, view, proj matrices (combined)
	D3DXHANDLE mhTech;
	D3DXHANDLE mhWVP;

	void setupFX();
	void cleanUp();

	//the one and only sprite interface through which we do all of our sprite drawing
	ID3DXSprite* mSprite;

	//this will hold our states, i will be using it as a stack
	std::vector<GameState*> states;

public:
	Prismatic(HINSTANCE hInstance, std::string winCaption, D3DDEVTYPE devType, DWORD requestedVP);
	~Prismatic();

	/********************Needed for any program you instantiate***************************/
	bool checkDeviceCaps();
	void onLostDevice();
	void onResetDevice();
	void handleInput();
	void updateScene(float dt);
	void drawScene();
	/*************************************************************************************/

	//This function will have anything that is specific to the game engine initialization/cleanup
	bool Init();
	void CleanUp();

	//not sure if this is a good idea or not .  . . . . .
	void Quit() {PostQuitMessage(0); }

	//These functions will be used to manage our states
	void PushState(GameState *state); 	//Pushes a state onto the stack
	void PopState(GameState *state);	//Pops the top state from the stack
	void ChangeState(GameState *state); //Changes from one state to another

	//camera and matrix build functions
	void buildViewMtx();
	void buildProjMtx();

	//gives all of our states access to the sprite object
	ID3DXSprite* Sprite() { return mSprite; }

	// these function will return the x or y coordinate of the mouse
	//	with the game world as a flat plane with z == 0
	float Prismatic::mouseXCoord();
	float Prismatic::mouseYCoord();

};

#endif /* PRISMATIC_H_ */
